<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
    <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0"/>
    <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
    <title>title</title>
	<link rel="stylesheet" type="text/css" href="../../css/common.css"/>
    <link rel="stylesheet" type="text/css" href="../../css/api.css"/>
    <script src="../../template/js/jquery.js"></script>
	
	<script src="../../template/js/com/template.js"></script>
	<script src="../../resource/my.js"></script>
	<script src="../../script/api.js"></script>
    <script type="text/javascript" src="../../script/constants.js"></script>
    <style>
    	body{
    		display: -webkit-box;
	        -webkit-box-orient: vertical;
    	}
    	.roomHead {
    		margin: 0;
    		width: auto;
    		height:200px;
    		background-color: #339999;
    		color: #F7F6F6;
    	}
    	.room {
    		width: 90%;
    		height: 130px;
    		top: 0px;
			bottom: 0px;
			left: 0px;
			right: 0px;
			margin-left: auto;
			margin-right: auto;
    		background-color: #FFFFEE;
    		
    	}
    	.roomTable {
    		width: 100%;
    		height: 260px;
    		
    	}
    	.roomTable td {
    		height: 15%;
    		
    		padding-left: 25px;
    		border-bottom: 1px solid #D8D8D8;
    	}
    	.rmb {
    		background-color: #FFFFEE;
    		font-size: x-large;
    		font-weight:800; 
    		color: #FF6600;
    		text-align: center;
    	}
    	.bookRoom {
	    	width:100%;
	    	height:100%;
    		background-color: #FF9900;
    		font-size: x-large;
    		color: #F7F6F6;
    	}
    	.addRoom input{
    		width:40px;
    		height:75%;
    		margin-left: 20px;
    		background-color: #FFFFEE; 
    		border: 1px solid #6666FF;
    	}
    	.bzscf{
    		width:80%;
    		height:150px;
    		top: 0px;
			bottom: 0px;
			left: 0px;
			right: 0px;
			margin-left: auto;
			margin-right: auto;
    	}
    	.yxfj{
       		background-color:#509DD8;
       		color:#F7F6F6;
       		margin-top:5px;
       		margin-left:3px;
       		border:1px solid #005DA9;
       		width:30px;
       		height:20px;
       		line-height: 20px;
       		text-align: center;
       		font-size: small;
       }
       .noscroll,
		.noscroll body {
		    overflow: hidden;
		}
		.noscroll body {
		    position: relative;
		}
    	#bg{position: absolute;  top: 0%;  left: 0%;  width: 100%;background-color: black;  z-index:1001;  -moz-opacity: 0.7;  opacity:.70;  filter: alpha(opacity=70);}
    </style>
</head>
<body>	
<div style="height: 20px;"></div>
 <div style="display:none" id="bg"></div>  
		<div class="roomHead">
			<div class="header" id="header" >
				<div class="back btn" style="color: #FFFFFF;" tapmode="" onclick="api.closeWin()"></div>
				<div class="title" id="title" style="color: #FFFFFF;text-align: center;margin-right: 25px;"></div>
			</div>
			<div class="bzscf">
				<img src="../../image/bzscf2.jpg" class="img" style="width:100%;height: 100%;"/>
			</div>	
			
		</div>
		<form id="" method="post" >
			<table class="roomTable">
				<tbody>
					<tr>
   						<td style="width: 50%;">入住时间</td>
	   					<td style="width: 50%;">
	   						<input id="rzsj" type="date" value="" readonly="true"/>
	   						<input type="text" value="至" readonly="true"/>
	   						<input id="tfsj" type="date" readonly="true"/>
						</td>
   					</tr>	
					<tr>
						<td>房间数</td>
						<td id="fjs" >
							
						</td>
					</tr>
					
					<tr>
						<td>预订人</td>
						<td id="person">
						</td>
					</tr>
					<tr>
						<td>联系手机</td>
						<td id="phone">
						</td>
					</tr>
					
				</tbody>
			</table>	
			<table id="bookTable" class="" style="width: 100%;height: 60px;margin-top: 90px;" hidden="hidden">
				<tbody>
					<tr>
						<td class="rmb" style="width: 50%;"><span style="font-size: large;color: #FF6600;">&yen;</span><span id="je"></span></td>
						<td style="width: 50%;padding: 0;margin: 0;left: 0;"><input type="button" value="立即支付" class="bookRoom" onclick="bookRoomAction()"/></td>
					</tr>
				</tbody>
			</table>
		</form>
</body>
<script type="text/javascript" src="../../script/api.js"></script>
<script type="text/javascript" src="../../resource/jquery-1.js"></script>
<script type="text/javascript">
	var payid;
	var je;
	apiready = function(){
		var jdname = api.pageParam.jdname;
		$("#title").text(jdname);
		var orderid = api.pageParam.orderid;
		
		api.ajax({
	        url:'https://wechat.scjinsui.com:443/weixin/jdyd/ydfjxx.do?orderid='+orderid,
	        method: 'get',
	        cache: 'false',
	        timeout: 30,
	        dataType: 'json'
        },function(ret,err){
        	var data = eval("("+ret.list+")");
        	//alert(JSON.stringify(data));
        	if(data[0].STATUS == "0"){
        		var bookTable = document.getElementById("bookTable");
        		bookTable.hidden = false;
        	}
        	payid = data[0].NO;
        	var rzsj = getNowFormatDate(data[0].CHECK_TIME,0);
        	var tfsj = getNowFormatDate(data[0].CHECK_OUT_TIME,0);
        	//alert(rzsj);
        	$("#rzsj").val(rzsj);
        	$("#tfsj").val(tfsj);
        	$("#je").text(data[0].MONEY);
        	$("#person").text(data[0].PERSON);
        	$("#phone").text(data[0].PHONE);
        	$("#fjs").text(data.length);	
        });
	};
	Date.prototype.toLocaleString = function() {
          return this.getFullYear() + "-" + (this.getMonth() + 1) + "-" + this.getDate();
    };
	function strFormat(str){
	    var unixTimestamp = new Date(str) ;
		commonTime = unixTimestamp.toLocaleString();
		return commonTime;
 	}
	function getNowFormatDate(date , addDayCount) {

   		var now = new Date(date); 
		now.setDate(now.getDate()+addDayCount);
		//格式化日，如果小于9，前面补0  
		var day = ("0" + now.getDate()).slice(-2); 
		var mday =  ("0" + now.getDate()).slice(-2);
		var month = ("0" + (now.getMonth() + 1)).slice(-2);  
		//拼装完整日期格式  
		var date = now.getFullYear()+"-"+(month)+"-"+(day) ;  
		return date; 
        
	}
	function bookRoomAction(){
			je = $("#je").text();
			var width = document.documentElement.clientWidth;
			var height = document.documentElement.clientHeight;
        	var hh = document.body.scrollHeight;
			if(api.systemType == "android"){
			    $api.setStorage("frame","paymethod");
			    $('html').addClass('noscroll');
			 }else{
			    $("body").on("touchmove",function(event){
				event.preventDefault;
				}, false)
			 }
			 var dl_phone = $api.getStorage("dl_phone");
			 document.getElementById("bg").style.height = hh+"px";
			 document.getElementById("bg").style.display="";
	            	api.openFrame({
					    name: 'ylzf',
					    url: './paymethod.html',
					    rect: {
						    x:0,
						    y:height*0.6,
						    w:width,
						    h:height*0.4
					    },
					    pageParam: {
			           		dlzh:dl_phone,
			           		je:je
			         
					    }
				    });
       
		
		return false;
	}

		/**
		 *allspmc : allspmc,//商品名称
		       orderid : orderid,//订单号
		       dzObj : dzObj,//所有地址
		        bmc : bmc,//开票单位还是个人
		        seli : seli,//第几个地址
		        amc : amc1,//收货人姓名
	   	  		adh : adh1,//收货人电话
	   	  		adz : adz1,//收货人地址
	   	  		bsh :$("#kp_sh").val(),//税号
		    	bdzdh :$("#kp_dzdh").val(),//开票单位地址电话
		    	bkhh :$("#kp_khh").val(),//单位开户行账号
		    	bfplx :$("#kp_fplx").val(),//发票类型
		    	zje : allPrice1//金额 
		 */

		

	function uPay(){
	   
     var allPrice1 = je;

     var width = document.documentElement.clientWidth;
	 var height = document.documentElement.clientHeight;
	 var hh = document.body.scrollHeight;
	 if(api.systemType == "android"){
	    $api.setStorage("frame","paymethod");
	    $('html').addClass('noscroll');
	 }else{
	    $("body").on("touchmove",function(event){
		event.preventDefault;
		}, false)
	 }
	 document.getElementById("bg").style.height = hh+"px";
	 document.getElementById("bg").style.display="";
	 $api.setStorage("frame","");
	 $api.setStorage("upay","unionpay");
		api.openFrame({
		    name: 'jdylzf',
		    url: './unionpay.html',
		    rect: {
			    x:0,
			    y:height*0.4,
			    w:width,
			    h:height*0.6
		    },
		    pageParam: {
		       
		       orderid : payid,
		    	zje : allPrice1
		    }
	    });
	    }
	    function funcGoto(){
        if(api.systemType == "android"){
            $('html').removeClass('noscroll');
        }else{
            $("body").off("touchmove");
        }        
	     document.getElementById("bg").style.display="none";
	    }
	    
	    function funcGoto1(){
        if(api.systemType == "android"){
            $('html').removeClass('noscroll');
        }else{
            $("body").off("touchmove");
        }        
	     document.getElementById("bg").style.display="none";
	     api.closeToWin({
	     name: 'root'
         });
	    }
	    
	    
	    function show(){
	     $("#loadingToast").show();
	    }
	     
	    function hide(){
	     $("#loadingToast").hide();
	    } 
	function closeTj(){
	  api.closeFrame({
	   name:'zffs'
      });
	  api.closeWin({});
	}    
</script>
</html>